package com.monika.main.system.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @Author whh
 * @Date: 2023/04/15/ 2:05
 * @description
 */
public class StringUtil extends StringUtils {


    /**
     * 字符串是否为空
     * @param s
     * @return
     */
    public static boolean isEmpty(String s){
        return s == null || s.trim().length() == 0;
    }


    /**
     * 字符串不为空
     * @param s
     * @return
     */
    public static boolean isNotEmpty(String s){
        return !isEmpty(s);
    }


    /**
     * 是否包含字符串
     *
     * @param str 验证字符串
     * @param strs 字符串组
     * @return 包含返回true
     */
    public static boolean inStringIgnoreCase(String str, String... strs)
    {
        if (str != null && strs != null)
        {
            for (String s : strs)
            {
                if (str.equalsIgnoreCase(trim(s)))
                {
                    return true;
                }
            }
        }
        return false;
    }


    /**
     *
     * @param msg
     * @return
     */
    public static String getBlock(Object msg)
    {
        if (msg == null)
        {
            msg = "";
        }
        return "[" + msg.toString() + "]";
    }
}
